<!--印前详情-->
<div class="wrap">
	<div class="header">
		<span id="return">返回上一级</span>
	</div>
	<!--详情内容-->
	<ul class="order_list">
		<li>
			<label>订单编号</label>
			<span id="orderNum"></span>
		</li>
		<li>
			<label>订单状态</label>
			<span id="orderStatus"></span>
		</li>
		<li>
			<label>付款方式</label>
			<span id="orderPayway"></span>
		</li>
		<li>
			<label>公司名称</label>
			<span id="khName"></span>
		</li>
		<li>
			<label>联系人员</label>
			<span id="khConperson"></span>
		</li>
		<li>
			<label>联系电话</label>
			<span id="khTel"></span>
		</li>
		<li>
			<label>收货地址</label>
			<span id="khAddress"></span>
		</li>
		<li>
			<label>产品名称</label>
			<span id="cpName"></span>
		</li>
		<li>
			<label>产品数量</label>
			<span id="cpNum"></span>
		</li>
		<li>
			<label>产品规格</label>
			<span id="cpSize"></span>
		</li>
		<li>
			<label>工艺要求</label>
			<span id="cpCraft"></span>
		</li>
		<li>
			<label>交货日期</label>
			<span id="orderDeadline"></span>
		</li>
		<li>
			<label>备注信息</label>
			<span id="orderComment"></span>
		</li>
		<li>
			<a href="javascript:void(0)" id="orderSubmit">确认</a>
		</li>
	</ul>
</div>
<script>
	//返回上一级
	$("#return").on("click",function(){
		$("#main").empty();
		$.ajax({
			type:"get",
			url:"product_list.html",
			success:function(res){
				$("#main").append(res);
			}
		});
	})
	//用cookie获取id
	var id = $.cookie("id"),
		uid = $.cookie("uid");
	$("#orderNum").text(id);
	//订单详情
	$.ajax({
		type:"post",
		url:"http://39.108.164.20/device/SysUser/SelOrder",
		data:{
			uid:uid
		},
		dataType:"json",
		success:function(res){
			var data = res.result.data;
			for(let i=0;i<data.length;i++){
				if(id == data[i].order_id){
					$("#orderStatus").text(data[i].order_status);
					$("#orderPayway").text(data[i].order_payway);
					$("#khName").text(data[i].kh_name);
					$("#khConperson").text(data[i].kh_conperson);
					$("#khTel").text(data[i].kh_tel);
					$("#khAddress").text(data[i].kh_address);
					$("#cpName").text(data[i].cp_name);
					$("#cpNum").text(data[i].cp_num);
					$("#cpSize").text(data[i].cp_size);
					$("#cpCraft").text(data[i].cp_craft);
					$("#orderDeadline").text(data[i].order_deadline);
					$("#orderComment").text(data[i].order_comment);		
				}
			}
		}
	});
	//确认订单
	$("#orderSubmit").on("click",function(){
		$.ajax({
			type:"post",
			url:"http://39.108.164.20/device/SysUser/SureOrder",
			dataType:"json",
			data:{
				order_id:id,
				type:"prePrintSure"
			},
			success:function(res){
				alert(res.result.msg)
			}
		});
	})